﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace MidSoft.Sys
{
    public partial class sys : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 加载菜单
            ChinaSoft.BLL.Common.Bind bllBind = new ChinaSoft.BLL.Common.Bind();
            DataSet ds = bllBind.GetDataSet("*", "V_RolePower", " (PowerId  between 31 and 37) and UserAccount='" + ChinaSoft.Common.Input.SetString(Session["UserAccount"]) + "' order by Sort,CreateTime desc");
            string result = string.Empty;
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataTable dt = ds.Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    result = GetResult(result, dt.Rows[i]["PowerId"]);
                }
            }
            LiterMenu.Text = result;
            #endregion
        }

        private string GetResult(string result, object input)
        {
            switch (ChinaSoft.Common.Input.SetInt(input))
            {
                case 31:
                    result += "<li><a href=\"javascript:routeToWorkSpace('/Sys/Organize/list.aspx')\" title='组织机构'>组织机构</a></li>";
                    break;
                case 32:
                    result += "<li><a href=\"javascript:routeToWorkSpace('/Sys/Department/list.aspx')\" title='部门管理'>部门管理</a></li>";
                    break;
                case 33:
                    result += "<li><a href=\"javascript:routeToWorkSpace('/Sys/PermissionList.aspx')\" title='权限列表'>权限列表</a></li>";
                    break;
                case 34:
                    result += "<li><a href=\"javascript:routeToWorkSpace('/Sys/RoleList.aspx')\" title='角色管理'>角色管理</a></li>";
                    break;
                case 35:
                    result += "<li class=\"select\"><a href=\"javascript:routeToWorkSpace('/Sys/UserList.aspx')\" title='用户管理'>用户管理</a></li>";
                    break;
                case 36:
                    result += "<li><a href=\"javascript:routeToWorkSpace('/Sys/CustomerList.aspx')\" title='甲方单位'>甲方单位</a></li>";
                    break;
                case 37:
                    result += "<li><a href=\"javascript:routeToWorkSpace('/Sys/Provide/List.aspx')\" title='供应商'>供应商</a></li>";
                    break;
            }
            return result;
        }
    }
}